package com.jcl.cloud.services.crawler.brain.task;


import java.beans.ConstructorProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class WorkerHandlerWrapper implements Runnable {
    private static final Logger log = LoggerFactory.getLogger(WorkerHandlerWrapper.class);
    private Object object;
    private WorkerHandler workerHandler;

    public void run() {
        try {
            this.workerHandler.execute(this.object);
        } catch (Exception e) {
            log.error(e.getMessage() + "executeCmdTread 异常:{}", e);
            this.workerHandler.handlerException(this.object, e.getMessage());
        }

    }

    @ConstructorProperties({"object", "workerHandler"})
    public WorkerHandlerWrapper(Object object, WorkerHandler workerHandler) {
        this.object = object;
        this.workerHandler = workerHandler;
    }
}

